<html>
<head><meta charset="utf-8"><title>multiversioning (chit chat?) · project-portable-simd · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/index.html">project-portable-simd</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html">multiversioning (chit chat?)</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227064153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227064153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227064153">(Feb 20 2021 at 04:10)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> good call on <code>retpoline</code>.  Turns out it's not supported on macOS which probably has something to do with my being unaware of it.  I ran my benchmarks and sure enough with it enabled multiversioned function calls had huge overhead, something like 20 cycles on my machine.  Switching to branching for all functions dropped that back down to something like &lt;1 cycle</p>



<a name="227064573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227064573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227064573">(Feb 20 2021 at 04:17)</a>:</h4>
<p>Sounds about right.</p>



<a name="227065126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065126">(Feb 20 2021 at 04:27)</a>:</h4>
<p>Are there any other mitigation techniques I should know about? The LLVM docs seemed to indicate that retpolines are the most common one.</p>



<a name="227065217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065217">(Feb 20 2021 at 04:29)</a>:</h4>
<p>Security is unfortunately... Very far from the field I work in usually</p>



<a name="227065289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065289">(Feb 20 2021 at 04:30)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> what did Infra ever say regarding shipping more than one feature level of major targets?</p>



<a name="227065495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065495">(Feb 20 2021 at 04:34)</a>:</h4>
<p>Oh yeah, I also meant to say that shipping multiple stds might help with HashMap since the docs indicated it's SIMD accelerated</p>



<a name="227065553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065553">(Feb 20 2021 at 04:35)</a>:</h4>
<p>naisu~</p>



<a name="227065883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065883">(Feb 20 2021 at 04:41)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> nagisa said they don't have any real objections to shipping more targets, it probably is mostly going to come down if they have the CI time. they might prefer to ship what is effectively a separate target rather than an additional component to a target.</p>



<a name="227065949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065949">(Feb 20 2021 at 04:42)</a>:</h4>
<p>oh i completely agree on that part</p>



<a name="227065958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065958">(Feb 20 2021 at 04:42)</a>:</h4>
<p>nagisa was unsure why -Zbuild-std wouldn't address our needs tho'.</p>



<a name="227065963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065963">(Feb 20 2021 at 04:42)</a>:</h4>
<p>targets are all fake anyway, if it builds a binary that runs the target name doesn't matter</p>



<a name="227065965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065965">(Feb 20 2021 at 04:42)</a>:</h4>
<p>heh.</p>



<a name="227065994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065994">(Feb 20 2021 at 04:43)</a>:</h4>
<p>well now that i'm on a real keyboard and not a phone keyboard i'll give you the long answer as to why -Zbuild-std can't just solve all of our problems.</p>



<a name="227065996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227065996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227065996">(Feb 20 2021 at 04:43)</a>:</h4>
<p>actually it basically can.</p>



<a name="227066072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066072">(Feb 20 2021 at 04:44)</a>:</h4>
<p>less joking: the only problem that -Zbuild-std <em>can't fix</em> is Caleb's goal of having runtime feature detection and opt-in higher features</p>



<a name="227066079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066079">(Feb 20 2021 at 04:44)</a>:</h4>
<p>because with -Zbuild-std you've turned on the feature for the full build</p>



<a name="227066080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066080">(Feb 20 2021 at 04:44)</a>:</h4>
<p>Josh mentioned that he expects it to not be stable.<br>
Mmm~</p>



<a name="227066082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066082">(Feb 20 2021 at 04:44)</a>:</h4>
<p>Right.</p>



<a name="227066113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066113">(Feb 20 2021 at 04:45)</a>:</h4>
<p>which would let us do proper rounding on sse4+ and would even let us do cfg to have higher quality sse2 rounding</p>



<a name="227066124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066124">(Feb 20 2021 at 04:45)</a>:</h4>
<p>and we'd never have to hit libm, and wouldn't need a vector math lib</p>



<a name="227066180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066180">(Feb 20 2021 at 04:46)</a>:</h4>
<p>but then we lose runtime opt-in <em>unless</em></p>



<a name="227066181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066181">(Feb 20 2021 at 04:46)</a>:</h4>
<p>big unless</p>



<a name="227066187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066187">(Feb 20 2021 at 04:46)</a>:</h4>
<p>we're willing to just write the function twice</p>



<a name="227066219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066219">(Feb 20 2021 at 04:47)</a>:</h4>
<p>can't we use target_feature(enable)?</p>



<a name="227066292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066292">(Feb 20 2021 at 04:49)</a>:</h4>
<p>we could, but the problem is that the best code to use with sse2 is literally different from the best code to use with sse4 (because of llvm's bad codegen)</p>



<a name="227066362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066362">(Feb 20 2021 at 04:50)</a>:</h4>
<p>so instead of using a simplistic multiversion macro that takes a function and splits it into two identical functions, one of which has target_feature_enable, we'd need to write two functions, eg: round_sse2 and round_sse4, and then the runtime feature selection is a check and branch to one or the other functions that way</p>



<a name="227066375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066375">(Feb 20 2021 at 04:50)</a>:</h4>
<p>of course, this makes things immensely difficult for downstreamers</p>



<a name="227066389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066389">(Feb 20 2021 at 04:51)</a>:</h4>
<p>it's no longer as simple as saying <code>foo.round()</code> and trusting the compiler</p>



<a name="227066405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066405">(Feb 20 2021 at 04:51)</a>:</h4>
<p>mm.</p>



<a name="227066406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066406">(Feb 20 2021 at 04:51)</a>:</h4>
<p>because runtime opt-in has to be picked at careful levels of granularity when it's used, otherwise you're doing too many checks</p>



<a name="227066480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066480">(Feb 20 2021 at 04:52)</a>:</h4>
<p>of course, separate from any of that, llvm can have better codegen, which would reduce some burden, but llvm having better codegen is almost entirely orthogonal to any other concern.</p>



<a name="227066571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066571">(Feb 20 2021 at 04:54)</a>:</h4>
<p>Even SSE3 probably has better codegen options because of pabs</p>



<a name="227066600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066600">(Feb 20 2021 at 04:55)</a>:</h4>
<p>Actually I think that's integer only</p>



<a name="227066665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066665">(Feb 20 2021 at 04:56)</a>:</h4>
<p>oh friend i think you mean ssse3, not just sse3</p>



<a name="227066667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066667">(Feb 20 2021 at 04:56)</a>:</h4>
<p>because naming is hard and intel is Good at it.</p>



<a name="227066678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066678">(Feb 20 2021 at 04:56)</a>:</h4>
<p>Whoops yeah</p>



<a name="227066688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066688">(Feb 20 2021 at 04:56)</a>:</h4>
<p>SSE3 is addsub, for complex multiplication and division</p>



<a name="227066704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066704">(Feb 20 2021 at 04:57)</a>:</h4>
<p>And something else</p>



<a name="227066708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066708">(Feb 20 2021 at 04:57)</a>:</h4>
<p><a href="https://github.com/Lokathor/safe_arch/blob/main/src/x86_x64/sse3.rs">https://github.com/Lokathor/safe_arch/blob/main/src/x86_x64/sse3.rs</a></p>



<a name="227066722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227066722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227066722">(Feb 20 2021 at 04:57)</a>:</h4>
<p>Ah hadd right</p>



<a name="227074695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227074695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227074695">(Feb 20 2021 at 07:47)</a>:</h4>
<p><span class="user-mention" data-user-id="312331">@Caleb Zulawski</span> I don't know the canonical set of mitigations these days. Retpolines are the big one, but there are also a few other speculation-prevention ones i think?</p>



<a name="227074756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227074756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227074756">(Feb 20 2021 at 07:48)</a>:</h4>
<p>I would check what Linux distributions are building C code with and see how to enable that in LLVM.</p>



<a name="227076914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227076914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227076914">(Feb 20 2021 at 08:29)</a>:</h4>
<p>hadd/dp and such just turn into a sequence of sse2-level instructions in both AMD and intel last i heard, e.g. the reason to use them is just for slightly smaller instruction encoding. Unless things have changed a lot, they're fast exactly nowhere. for fast stuff you really want to avoid horizontal, and generally need to transpose then work in batches.</p>
<p>(well... there are a few decently fast horizontal things. _mm_madd_epi16, _mm_maddubs_epi16, _mm_sad_epu8, and others that use the same instructions (pmaddwd, psadbw, pmaddubsw, psadbw, ...) are all fast but only exist for integers, and are just different enough from what you expect to be hard to use. they're very good if you can make use of them though, which is possible for some software rendering and image processing operations, as IIUC these were designed for use in video codecs)</p>
<p>Edit: in retrospect, this was pretty off topic... I guess this is "chit chat" tho. It would be nice if we could support those more esoteric ops but, probably not going to happen.</p>



<a name="227111924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227111924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227111924">(Feb 20 2021 at 19:22)</a>:</h4>
<p>yeah some of these threads would benefit from being on-topic and others benefit from being deliberately not. :^) just "eh whatever".</p>



<a name="227112054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112054">(Feb 20 2021 at 19:25)</a>:</h4>
<p>Yeah, I specified this is chit chat for that reason lol</p>



<a name="227112057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112057">(Feb 20 2021 at 19:25)</a>:</h4>
<p>Tangentially related to stdsimd</p>



<a name="227112359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112359">(Feb 20 2021 at 19:31)</a>:</h4>
<p><span class="user-mention" data-user-id="209168">@Thom Chiovoloni</span> Would it be a good idea to offer horizontal integer adds and not floating point horizontal adds, then?</p>



<a name="227112384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112384">(Feb 20 2021 at 19:32)</a>:</h4>
<p>There are still "good" ways of doing them even if they aren't a single instruction, so I think they may be worthwhile</p>



<a name="227112452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112452">(Feb 20 2021 at 19:32)</a>:</h4>
<p>I know there are some tricks for horizontal adds in neon as well</p>



<a name="227112478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112478">(Feb 20 2021 at 19:33)</a>:</h4>
<p>yeah we should still offer the float versions. also, those ops arent really horizontal adds. they're int dot products or sums of horizontal differences.</p>



<a name="227112511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112511">(Feb 20 2021 at 19:33)</a>:</h4>
<p>(and even int dot product is kinda wrong, but it can be used to build one)</p>



<a name="227112543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112543">(Feb 20 2021 at 19:34)</a>:</h4>
<p>thats why i described them as "just different enough from what you expect to be hard to use"</p>



<a name="227112605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112605">(Feb 20 2021 at 19:34)</a>:</h4>
<p>and there are reasons to use the float horizontal ops, they use less instruction bandwidth than the equivalent series of sse2 instructions. just, its not like thye're actually faster than them</p>



<a name="227112633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112633">(Feb 20 2021 at 19:35)</a>:</h4>
<p>In our situation I expect to use <code>llvm.vector.reduce.add</code> etc so we shouldn't have to worry about the implementation details</p>



<a name="227112641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112641">(Feb 20 2021 at 19:35)</a>:</h4>
<p>reducing instruction bandwidth is still useful</p>



<a name="227112650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112650">(Feb 20 2021 at 19:35)</a>:</h4>
<p>just not in most situations</p>



<a name="227112836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227112836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227112836">(Feb 20 2021 at 19:38)</a>:</h4>
<p>right. i'm skeptical that llvm.vector.reduce.add will ever lower into psadbw for example, even if it is used to compute absolute differences. that said, itd be worth knowing if other isas have similar ops. if not its probably less of a big deal. if they do, IMO it might be worht supporting it even if it is a bit of a weird operation (i'd actually assume they do in some form, due to the use in motion estimation required for various video codecs)</p>



<a name="227113057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227113057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227113057">(Feb 20 2021 at 19:42)</a>:</h4>
<div class="codehilite"><pre><span></span><code>sum:                                    # @sum
        pshufd  xmm1, xmm0, 238                 # xmm1 = xmm0[2,3,2,3]
        paddd   xmm1, xmm0
        pshufd  xmm0, xmm1, 85                  # xmm0 = xmm1[1,1,1,1]
        paddd   xmm0, xmm1
        movd    eax, xmm0
        ret
</code></pre></div>



<a name="227113406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227113406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227113406">(Feb 20 2021 at 19:49)</a>:</h4>
<div class="codehilite"><pre><span></span><code>sum:                                    # @sum
        pshufd  xmm1, xmm0, 238                 # xmm1 = xmm0[2,3,2,3]
        paddw   xmm1, xmm0
        pshufd  xmm0, xmm1, 85                  # xmm0 = xmm1[1,1,1,1]
        paddw   xmm0, xmm1
        movdqa  xmm1, xmm0
        psrld   xmm1, 16
        paddw   xmm1, xmm0
        movd    eax, xmm1
        ret
</code></pre></div>



<a name="227114336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227114336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227114336">(Feb 20 2021 at 20:03)</a>:</h4>
<p>ahhh.</p>



<a name="227117217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117217">(Feb 20 2021 at 20:53)</a>:</h4>
<p>tbh I'd like it if we could just provide like into_iter and then sum(), really.</p>



<a name="227117251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117251">(Feb 20 2021 at 20:54)</a>:</h4>
<p>Interesting idea, I think that would work</p>



<a name="227117310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117310">(Feb 20 2021 at 20:54)</a>:</h4>
<p>Implement Sum and Product</p>



<a name="227117349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117349">(Feb 20 2021 at 20:55)</a>:</h4>
<p>seems unlikely to compile well, tbh. but if it does that seems fine. Even if it's not an efficient operation or a common one in well-written (fsvo well-written) SIMD code, it's still a pretty common one for naively written simd code.</p>



<a name="227117408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117408">(Feb 20 2021 at 20:56)</a>:</h4>
<p>Why wouldn't it compile well?  We would still use the intrinsic</p>



<a name="227117411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117411">(Feb 20 2021 at 20:56)</a>:</h4>
<p>hmm, via specialization?</p>



<a name="227117421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117421">(Feb 20 2021 at 20:57)</a>:</h4>
<p>Why specialization?  Sum and Product are traits that can be implemented on our iterator</p>



<a name="227117423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117423">(Feb 20 2021 at 20:57)</a>:</h4>
<p>yeah you can provide the function an implementation even if it's normally implied.</p>



<a name="227117439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117439">(Feb 20 2021 at 20:57)</a>:</h4>
<p>hm, maybe it's been too long since I looked at the signatures of sum/product.</p>



<a name="227117810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117810">(Feb 20 2021 at 21:04)</a>:</h4>
<p><a href="https://doc.rust-lang.org/std/iter/trait.Sum.html">https://doc.rust-lang.org/std/iter/trait.Sum.html</a></p>



<a name="227117920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117920">(Feb 20 2021 at 21:06)</a>:</h4>
<p>actually now that I think about it, it would be somewhat problematic because it introduces a branch</p>



<a name="227117927"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117927" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117927">(Feb 20 2021 at 21:07)</a>:</h4>
<p>because you can call sum after partially iterating</p>



<a name="227117943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117943">(Feb 20 2021 at 21:07)</a>:</h4>
<p>right, although in theory that should be optimized out...</p>



<a name="227117951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227117951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227117951">(Feb 20 2021 at 21:07)</a>:</h4>
<p>yeah, I think that would probably optimize out</p>



<a name="227123838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227123838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227123838">(Feb 20 2021 at 22:36)</a>:</h4>
<p>are you saying that you'd into_iter and then sum an individual simd value? not like a whole list of values being summed?</p>



<a name="227123886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227123886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227123886">(Feb 20 2021 at 22:37)</a>:</h4>
<p>like <code>my_f32x8.into_iter().sum()</code></p>



<a name="227123965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227123965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227123965">(Feb 20 2021 at 22:38)</a>:</h4>
<p>that sounds like <em>a</em> way to handle it, but... i sure wouldn't expect that as the way to handle it if i was a person who knew about horizontal sums.</p>



<a name="227123977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227123977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227123977">(Feb 20 2021 at 22:38)</a>:</h4>
<p>like i think the rustdoc there, and thus the discoverability, might be very bad if we're not careful</p>



<a name="227123993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227123993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227123993">(Feb 20 2021 at 22:39)</a>:</h4>
<p>rustdoc can be poor in many ways, but one of them is surely traits</p>



<a name="227126611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227126611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227126611">(Feb 20 2021 at 23:23)</a>:</h4>
<p>I know it's an unusual API from the "expecting a horizontal fn" / "SIMD programmer" perspective but it's a very Rusty API.<br>
And I kinda think we should provide IntoIter anyways because it means you can <code>for</code> loop a SIMD vector.</p>



<a name="227126681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227126681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227126681">(Feb 20 2021 at 23:24)</a>:</h4>
<p>Fwiw you can already do it with to_array or to_slice</p>



<a name="227126682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227126682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227126682">(Feb 20 2021 at 23:24)</a>:</h4>
<p>I strongly feel that people should convert to arrays (which we make very easy) if they want do stuff like that</p>



<a name="227126687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227126687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227126687">(Feb 20 2021 at 23:24)</a>:</h4>
<p>Yeah</p>



<a name="227126715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/multiversioning%20%28chit%20chat%3F%29/near/227126715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/multiversioning.20(chit.20chat.3F).html#227126715">(Feb 20 2021 at 23:25)</a>:</h4>
<p>i always think of a simd value as being a "nearly opaque" type that i can get some elements back from later if i ask right, but i shouldn't be checking up on the interior before then.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>